﻿@if (Request.IsAuthenticated)
{
    <table class="login">
        <tr>
            <td colspan="2">
                <span>Xin chào @Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })!
                </span>
            </td>
        </tr>
        @if (User.IsInRole("Administration"))
        { 
            <tr>
                <td colspan="2">
                    <span>
                        @Html.ActionLink("Quản lý tài khoản", "ManageAccount", "Account")
                    </span>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <span>
                        @Html.ActionLink("Quản lý hãng xe", "Index", "Manufacturer")
                    </span>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <span>
                        @Html.ActionLink("Quản lý xe", "Manager", "Vehicle")
                    </span>
                </td>
            </tr>
        }
        <tr>
            <td colspan="2">@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
                            {
                @Html.AntiForgeryToken()
                <a href="javascript:document.getElementById('logoutForm').submit()">Đăng xuất</a>
                            }</td>
        </tr>
    </table>
}
else
{
    using (Html.BeginForm("login", "account", new { ReturnUrl = ViewBag.ReturnUrl }))
    {
    @Html.AntiForgeryToken()
    
                            
    <table class="login">
        <tr>
            <td class="label">
                <label for="UserName">Tài khoản:</label></td>
            <td>
                <input data-val="true" data-val-required="The User name field is required." id="UserName" name="UserName" type="text" value="" />
            </td>
        </tr>
        <tr>
            <td class="label">
                <label for="Password">Mật khẩu:</label></td>
            <td>
                <input data-val="true" data-val-required="The Password field is required." id="Password" name="Password" type="password" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input data-val="true" data-val-required="The Remember me? field is required." id="RememberMe" name="RememberMe" type="checkbox" value="true" /><input name="RememberMe" type="hidden" value="false" />
                <label class="checkbox" for="RememberMe">Ghi nhớ?</label></td>
        </tr>
        <tr>
            <td><a href="/account/Register">Đăng ký</a></td>
            <td>
                <input style="float: right" type="submit" value="Đăng nhập" /></td>

        </tr>
    </table>
    
    }
}
